import { baseUrl } from './defaultUrl.js'


export default function request(url, data = {}, method = 'GET') {
  return new Promise((resolve, reject) => {
    uni.request({
      url: baseUrl + url,
      data,
      header: { cookie: 'MUSIC_U=d71c76f8a46ba46f68bd087412950d576b5a25bed846d2e62b3deb3e844627d10931c3a9fbfe3df2; Max-Age=1296000; Expires=Sun 5 Sep 2021 03:05:35 GMT; Path=/;' },
      timeout: 10000,
      dataType: 'json',
      success: res => {
        resolve(res.data)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}
